using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class WaterMarkPassWordBox : UserControl
	{
		public static DependencyProperty strHintProperty = DependencyProperty.Register("strHint", typeof(string), typeof(WaterMarkPassWordBox), new PropertyMetadata(null, new PropertyChangedCallback(WaterMarkPassWordBox.strHintPropertyChanged)));
		internal UserControl userControl;
		internal TextBlock txtHint;
		internal PasswordBox passWordInput;
		private bool _contentLoaded;
		public event RoutedEventHandler PasswordChanged;
		public string strHint
		{
			get
			{
				return (string)base.GetValue(WaterMarkPassWordBox.strHintProperty);
			}
			set
			{
				base.SetValue(WaterMarkPassWordBox.strHintProperty, value);
			}
		}
		public string Password
		{
			get
			{
				return this.passWordInput.get_Password();
			}
			set
			{
				this.passWordInput.set_Password(value);
			}
		}
		public WaterMarkPassWordBox()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.WaterMarkPassWordBox_Loaded));
		}
		private void WaterMarkPassWordBox_Loaded(object sender, RoutedEventArgs e)
		{
			if (base.get_Padding().get_Bottom() == 0.0 && base.get_Padding().get_Left() == 0.0 && base.get_Padding().get_Right() == 0.0 && base.get_Padding().get_Top() == 0.0)
			{
				base.set_Padding(new Thickness(10.0, 10.0, 0.0, 0.0));
			}
			if (this.passWordInput.get_Password() != null && this.passWordInput.get_Password().get_Length() != 0)
			{
				this.txtHint.set_Visibility(1);
			}
		}
		private static void strHintPropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == WaterMarkPassWordBox.strHintProperty)
			{
				WaterMarkPassWordBox waterMarkPassWordBox = dependencyObject_0 as WaterMarkPassWordBox;
				waterMarkPassWordBox.txtHint.set_Text(waterMarkPassWordBox.strHint);
			}
		}
		private void passWordInput_GotFocus(object sender, RoutedEventArgs e)
		{
			this.txtHint.set_Visibility(1);
		}
		private void passWordInput_LostFocus(object sender, RoutedEventArgs e)
		{
			if (this.passWordInput.get_Password() == null || this.passWordInput.get_Password().get_Length() == 0)
			{
				this.txtHint.set_Visibility(0);
			}
		}
		private void passWordInput_PasswordChanged(object sender, RoutedEventArgs e)
		{
			if (this.PasswordChanged != null)
			{
				this.PasswordChanged.Invoke(sender, e);
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/CommonUseControl/WaterMarkPassWordBox.xaml", 2));
			this.userControl = (UserControl)base.FindName("userControl");
			this.txtHint = (TextBlock)base.FindName("txtHint");
			this.passWordInput = (PasswordBox)base.FindName("passWordInput");
		}
	}
}
